package artandco.utils;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * ContextListener.java
 * 
 * @version 1.0
 * @date 26 mai 2011
 */
public class ContextListener implements ServletContextListener {

	public static EntityManagerFactory emf;

	public void contextDestroyed(ServletContextEvent event) {
	}

	/**
	 * contextInitialized
	 * 
	 * @param event
	 * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
	 */
	public void contextInitialized(ServletContextEvent event) {
		event.getServletContext().setAttribute("emf", Persistence.createEntityManagerFactory("artandco"));
	}
}
